#include "Wheel.h"



void SetWheelPwm(pwm_channel_enum PwmPin, gpio_pin_enum DirPin, int32 duty)
{
    if (duty < 0)
    {
        //if (duty > -500)duty = -500;
        if (PwmPin == Wheel1_pwm || PwmPin == Wheel4_pwm)
            gpio_set_level(DirPin, 0);
        else
            gpio_set_level(DirPin, 1);

        pwm_set_duty(PwmPin, -duty);
    }
    else
    {
        //if (duty < 500)duty = 500;
        if (PwmPin == Wheel1_pwm || PwmPin == Wheel4_pwm)
            gpio_set_level(DirPin, 1);
        else
            gpio_set_level(DirPin, 0);
        pwm_set_duty(PwmPin, duty);
    }

}